﻿using System.Collections.Generic;
using System.Linq;

namespace EPiMVC.Templates.Web.ViewModels
{
    public class Node<T> : Structure<T>
    {
        private T value;

        public Node(T value)
        {
            this.value = value;
        }

        public T Value 
        {
            get { return value; }
        }

        public bool IsFirstChild
        {
            get
            {
                if (Parent == null)
                    return false;

                return Parent.Nodes.First() == this;
            }
        }

        public bool IsLastChild
        {
            get
            {
                if (Parent == null)
                    return false;

                return Parent.Nodes.Last() == this;
            }
        }
    }
}